package com.huitone.smspfm.context.app;
/**   
* @Title AppShutDownHook.java 
* @Package com.huitone.smspfm.context.app 
* @Description TODO(用一句话描述该文件做什么) 
* @author ybliang   
* @date 2017年3月31日 上午10:27:07 
* @version V1.0   
*/
public class AppShutDownHook extends Thread {

    private ShutDownCallback shutDownCallback = null;
    
    public AppShutDownHook() {}
    
    public AppShutDownHook(ShutDownCallback shutDownCallback) {
    	this.shutDownCallback = shutDownCallback;
    }
	
	@Override
	public void run() {
		
		if (shutDownCallback != null) {
			shutDownCallback.callback();
		}
	}

	public interface ShutDownCallback{
		void callback();
	}

	public AppShutDownHook setShutDownCallback(ShutDownCallback shutDownCallback) {
		this.shutDownCallback = shutDownCallback;
		return this;
	}
}
